package com.abc20230319.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/back")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/test")
    public CommonResult<?> Hello() {
        return CommonResult.success("Hello World");
    }

    @PostMapping("/post")
    public CommonResult<?> post(@RequestBody PostRequestVO postRequest) {
        List<String> list1 = userService.getRoleList(postRequest.getUsername());
        List<String> list2 = userService.getPermissionList(postRequest.getUsername());
        PostResVO postResVO = new PostResVO();
        postResVO.setList1(list1);
        postResVO.setList2(list2);
        return CommonResult.success(postResVO);
    }

    @GetMapping("/get")
    public CommonResult<?> get() {
        System.out.println("get成功");
        return CommonResult.success("get成功");
    }
}
